Removes horizontal and vertical black lines from 1 bit images. After removing the lines, any intersecting characters or other image content will be reconstructed as accurately as possible.
→
The uncompressed image to be processed must reside in the Get Queue prior to REQ_EXEC. Typically, the image will be fully contained in the Get Queue, but that is not a requirement. The output image will be placed into the Put Queue during REQ_EXEC.
Padding pixels present at the end of each line may be modified by this operation.
This operation relies primarily on three parameters to select the lines to remove: minimum length, maximum thickness, and minimum aspect ratio. Of the three, minimum length is the most commonly adjusted one. All three criteria must be true of a line for it to be removed. A fourth parameter, maximum gap, allows a broken line to be treated as a single line instead of multiple smaller lines. The remaining parameters control optional activities applied in conjunction with line removal.
There are two independent sets of parameters, one for horizontal lines (u.SC2.HorizontalLine) and one for vertical lines (u.SC2.VerticalLine).
- Subcode is set to SF_SUBCODE_REMOVE_LINES (2).
- u.SC2.HorizontalLine.MinimumAspectRatio and u.SC2.VerticalLine.MinimumAspectRatio are set to the minimum aspect ratio of a line to be removed. The aspect ratio is the length of the line divided by the thickness. Set lower if short, thick lines are not being removed and higher if items that are not lines are being removed. Valid values are floating point values from 1.0 to 1000.0. A common default is 12.0.
- u.SC2.HorizontalLine.MinimumLength and u.SC2.VerticalLine.MinimumLength are set to the maximum length, in pixels, of the shortest line to remove. Any line smaller than this length will not be removed. Note that this parameter is very sensitive to the image resolution and should generally be thought of in inches. Valid values are 10 to 20,000 and 150 (0.75 inches) is a good default at 200 DPI. If the value is set too low, this operation will begin to remove parts of characters. This value should be set larger than the width of text characters.
- u.SC2.HorizontalLine.MaximumThickness and u.SC2.VerticalLine.MaximumThickness are set to the maximum thickness, in pixels, of lines to be removed. Lines that exceed this thickness will not be removed. Long lines that are very close to this limit may have the thinner sections removed and the thicker sections retained. Valid values are from 1 to 50 and 15 works well in most cases. Using a value about 5 greater than the thickness of the thickest line also works well.
- u.SC2.HorizontalLine.MaximumGap and u.SC2.VerticalLine.MaximumGap are set to the maximum gap, in pixels, that the operation will tolerate in a continuous line. Activating this feature re-attaches broken segments for removal purposes. For poor quality images, such as dot matrix and microfilmed documents, this value can be set as high as 20. Setting this value higher than 3 invokes our Super-Line technology. The Super-Line technology takes a little longer, but can accurately detect even the most broken up lines. Valid values are 0 to 20 and 1 works well in most cases.
- u.SC2.HorizontalLine.MaximumCharacterRepairSize and u.SC2.VerticalLine.MaximumCharacterRepairSize are set to the maximum width and height, in pixels, of characters to repair. Valid values are 0 (disabled) to 100 and 20 works well in most cases. This value should be increased if text is not being adequately repaired, and decreased if the operation repairs things that should not have been repaired. Text larger than 14 point may require higher settings.
- u.SC2.HorizontalLine.EdgeCleaning and u.SC2.VerticalLine.EdgeCleaning are set to the distance, in pixels, from a removed line that the operation will clean up noise. Lines, and especially poor quality lines, often have a small amount of noise near them that should be removed when the line is removed. Valid values are 0 to 100 and 2 works well in most cases. The value should be increased if "shadows" remain after line removal and decreased if nearby text is damaged during line removal.
- Stride is set to the image line width in bytes including padding at the end of the line width or to 0. If Stride is 0 and PF_NoDibPad is set in PicFlags, the operation will compute the stride using: [ (PixelWidth*BitCount)/8 ]. If Stride is 0 and PF_NoDibPad is not set in PicFlags, the operation will compute the stride using: [ (((PixelWidth*BitCount)+31)&(~31))/8 ].
In addition to placing an output image into the Put Queue, this operation stores some output information into the PIC_PARM structure in the following locations.
- CountOfFeaturesDetected is set, during REQ_EXEC, to the number of lines removed, regardless of their orientation.
- OutputStride is set, during REQ_INIT and REQ_EXEC, to the image line width in bytes including padding at the end of the line.
- BiOut is set, during REQ_INIT and REQ_EXEC, to the attributes of the output image. Since this operation does not adjust the size of the image, BiOut will be set to a copy of the Head structure within PIC_PARM.
If the ReportingDatafield is set to point to a ScanFixReportDatainstance, then the defer function will be called with a value of RES_QUERYfor every line detected in the image. The ScanFixReportData.Subcode will be set to SF_SUBCODE_REMOVE_LINES, and ScanFixReportData.u.LineData will contain information about the currently selected line. If the line is to be deleted, then ScanFixReportData.u.LineData.DeleteLineshould be set to a non-zero value. If ScanFixReportData.Stopis set to a non-zero value, then the defer function will not be called for any subsequent lines in the image, and all remaining lines will be left in the image.